package com.jsbs.iam.auth.mapper;

import com.jsbs.iam.auth.dto.IamMenuManagerAlreadySelectDto;
import com.jsbs.iam.auth.dto.IamRoleAuthorizedApplicationDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface IamRoleMenuRelationMapper {

    /**
     * 功能描述：根据角色获取菜单权限列表
     * @param applyCode
     * @param roleList
     * @return
     */
    List<String> queryByRole(@Param("applyCode") String applyCode, @Param("roleList") List<String> roleList);

    /**
     * 功能描述：某角色每次编辑菜单树后保存时，都会删除该角色下该应用下的旧数据
     * @param iamRoleAuthorizedApplicationDto
     * @return
     */
    int deleteRoleMenuRelation(@Param("iamRoleAuthorizedApplicationDto") IamRoleAuthorizedApplicationDto iamRoleAuthorizedApplicationDto);

    /**
     * 功能描述：角色授权应用，插入数据至角色菜单表中
     * @param iamRoleAuthorizedApplicationDto
     * @return int
     */
    int insertRoleMenuRelation(@Param("iamRoleAuthorizedApplicationDto") IamRoleAuthorizedApplicationDto iamRoleAuthorizedApplicationDto);

    /**
     * 功能描述：角色授权应用系统勾选的菜单或按钮，回填
     * @param iamMenuManagerAlreadySelectDto
     * @return List
     */
    List<String> querySelectMenu(@Param("iamMenuManagerAlreadySelectDto") IamMenuManagerAlreadySelectDto iamMenuManagerAlreadySelectDto);
}